﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <link href="../Plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <link href="../zui/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../zui/css/font-awesome.min.css" rel="stylesheet" />
    <link href="../zui/css/zui.min.css" rel="stylesheet" />
    <link href="../zui/lib/layer/skin/default/layer.css" rel="stylesheet" />
    <link href="../Plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <link href="../zui/lib/swiper/css/swiper.min.css" rel="stylesheet" />
    <link href="../zui/css/app.css" rel="stylesheet" />
    <title></title>
    <style type="text/css">
        .form-control {
            font-size: 18px !important;
            height: 40px;
            line-height: 30px;
        }

        .form-group {
            font-size: 20px !important;
        }

        .btn {
            height: 50px;
            font-size: 18px !important;
        }

        body {
            font-size: 20px !important;
        }

        .wizard .content {
            min-height: 650px;
            width: 580px;
            margin: 0px !important;
        }

        .wizard > .content > .body {
            width: 100% !important;
            height: 100% !important;
            border-color: #d0c8c8 !important;
            border-width: 1px;
            border-style: solid;
        }
    </style>
</head>
<body>
    <div class="container" style="padding-left:0px !important;max-width:870px!important; width:870px">
        <div style="background-color:#eee;height:360px; overflow-y:scroll;border-radius:5px">
            <h1 style="margin-top:5px" id="title">修改密码</h1>
            <hr style="border-color:#d0c8c8" />
            <form class="form-horizontal" style="width:350px;padding-left:5px">
                <fieldset>

                    <div class="form-group">
                        <label for="exampleInputAccount4" class="col-xs-4">原密码</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control numkeyboard" value="" id="oldPwd" placeholder="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="exampleInputAccount4" class="col-xs-4">新密码</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control numkeyboard" value="" id="newPwd" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputAccount4" class="col-xs-4">确认密码</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control numkeyboard" value="" id="newPwd1" placeholder="">
                        </div>
                    </div>
                </fieldset>
            </form>
            <div class="shiyan-footer" style="bottom:90px;margin-bottom: 8px;">
                <button style="float:left;margin-right:5px;" class="btn btn-default btn-lg home-btn" type="button">返回主菜单</button>
                <button style="float:right" class="btn btn-primary btn-lg" id="saveBtn" type="button">保存</button>

            </div>
        </div>
    </div>
    <script src="../zui/lib/jquery/jquery.js"></script>
    <script src="../zui/js/md5.js"></script>
    <script src="../Plugins/pinyin/pinyin_dict_notone.js"></script>
    <script src="../Plugins/pinyin/pinyin_dict_withtone.js"></script>
    <script src="../Plugins/pinyin/pinyinUtil.js"></script>
    <script src="../Plugins/pinyin/simple-input-method.js"></script>
    <script src="../Plugins/jquery-ui/jquery-ui.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.mousewheel.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.extension-mobile.min.js"></script>
    <script src="../zui/js/zui.min.js"></script>
    <script src="../zui/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="../zui/lib/layer/layer.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../zui/lib/swiper/js/swiper.min.js"></script>
    <script src="../zui/js/utils.js"></script>
    <script src="../zui/js/app.js"></script>
    <script type="text/javascript">
        $(function () {
            //获取用户ID
            var userInfo = JSON.parse(sessionStorage.LoginUser);
            var userId = userInfo.user_id;
            //保存用户信息
            $("#saveBtn").click(function () {
                var oldPwd = $("#oldPwd").val();
                var newPwd = $("#newPwd").val();
                var newPwd1 = $("#newPwd1").val();
                if (oldPwd.trim()==""||newPwd.trim() == "") {
                    swal({
                        'title': '提示',
                        'text': '密码不能为空！',
                        'type': 'warning',
                        customClass: 'sweetAlert',
                    })

                    return;
                }
                if (newPwd.trim() != newPwd1.trim()) {
                     swal({
                        'title': '提示',
                        'text': '确认密码不一致！',
                        'type': 'warning',
                        customClass: 'sweetAlert',
                    })
                    return;
                }
                if (hex_md5(oldPwd.trim()) != userInfo.user_pwd) {
                        swal({
                        'title': '提示',
                        'text': '原密码错误！',
                        'type': 'warning',
                        customClass: 'sweetAlert',
                    });
                    return;
                }
                AjaxGet("正在修改用户密码...", "updateUserPassword",
                    {
                        userId: userId,
                        userPwd: newPwd
                    }, function (res) {
                        new top.$.zui.Messager('用户密码修改成功！', {
                            close: false,
                            type: 'success'
                        }).show();
                        location.href = "UserManage.html";
                    });

            });
            //返回菜单页按钮事件
            $(".home-btn").click(function () {
                $("#content-frame", parent.document).attr("src", "Menu.html");
                $("#menu-title", parent.document).removeClass().addClass("fa fa-home").text(" 功能菜单");
                $("#userinfo-btn", parent.document).removeClass("disabled");

            });
            //删除用户事件
            $("#deleteUserBtn").click(function () {
                swal({
                    title: "您确定要删除本用户么？",
                    text: "删除后将不可再恢复！",
                    type: "warning",
                    animation: false,
                    showCancelButton: true,
                    cancelButtonText: "取消",
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确认",
                    closeOnConfirm: false
                }, function () {
                    top.dataOpera.deleteUser(userId);
                    new top.$.zui.Messager('删除用户成功！', {
                        close: false,
                        type: 'success'
                    }).show();
                    location.href = "UserManage.html";
                });
            })
            //重置用户密码事件
            $("#resetPwdBtn").click(function () {
                swal({
                    title: "您确定要重置本用户密码么？",
                    text: "密码将被重置为“000000”！",
                    type: "warning",
                    animation: false,
                    showCancelButton: true,
                    cancelButtonText: "取消",
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确认",
                    closeOnConfirm: false
                }, function () {
                    top.dataOpera.updateUserPassword(userId, "000000");
                    new top.$.zui.Messager('用户密码重置成功！', {
                        close: false,
                        type: 'success'
                    }).show();
                    location.href = "UserManage.html";
                });
            })
            //返回用户列表页
            $(".back-btn").click(function () {
                location.href = "UserManage.html";
            })
        })
    </script>
</body>
</html>